function displayNotif(target,string) {
    var notif;
    var notifcontent;
    if(!document.getElementById('notif')) {
        notif = document.createElement('div');
        notif.id = 'notif';
        notifcontent = document.createElement('div');
        notifcontent.id = 'notifcontent';
        document.body.appendChild(notif);
        notif.appendChild(notifcontent);
    } else {
        notif = document.getElementById('notif');
        notifcontent = document.getElementById('notifcontent');
    }
    notifcontent.innerHTML = string;
    notif.style.display = 'block';
    notif.style.position = 'absolute';
    notifcontent.style.backgroundColor = 'red';
    notifcontent.style.padding = '2px';
    notifcontent.style.color = 'white';
    notifcontent.style.fontWeight = 'bold';
    var notifheight = notif.offsetHeight;
    var targetdiv = document.getElementById(target);
    targetdiv.focus();
    var targetheight = targetdiv.offsetHeight;
    var targetwidth = targetdiv.offsetWidth;
    var topposition = topPosition(targetdiv) - ((notifheight - targetheight) / 2) - 5;
    var leftposition = leftPosition(targetdiv) + targetwidth - 20;
    notif.style.top = topposition + 'px';
    notif.style.left = leftposition + 'px';
}

function hideNotif() {
    var notif = document.getElementById('notif');
    notif.style.display = 'none';
}


function leftPosition(target) {
    var left = 0;
    if(target.offsetParent) {
        while(1) {
            left += target.offsetLeft;
            if(!target.offsetParent) {
                break;
            }
            target = target.offsetParent;
        }
    } else if(target.x) {
        left += target.x;
    }
    return left;
}

function topPosition(target) {
    var top = 0;
    if(target.offsetParent) {
        while(1) {
            top += target.offsetTop;
            if(!target.offsetParent) {
                break;
            }
            target = target.offsetParent;
        }
    } else if(target.y) {
        top += target.y;
    }
    return top;
}